|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
EWSTask.java | 0% | 0% | 0% | 0% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.utils;
|
|
18 |
|
|
19 |
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
|
|
20 |
import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
|
|
21 |
import org.apache.tools.ant.AntClassLoader;
|
|
22 |
import org.apache.tools.ant.BuildException;
|
|
23 |
import org.apache.tools.ant.Location;
|
|
24 |
import org.apache.tools.ant.Task;
|
|
25 |
import org.apache.tools.ant.types.Path;
|
|
26 |
|
|
27 |
import java.io.File;
|
|
28 |
import java.io.FileWriter;
|
|
29 |
import java.io.IOException;
|
|
30 |
import java.io.PrintWriter;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* @author hemapani@opensource.lk
|
|
34 |
*/
|
|
35 |
public class EWSTask extends Task { |
|
36 |
private String outDir = "."; |
|
37 |
private String module = null; |
|
38 |
private Path classpath;
|
|
39 |
private File root;
|
|
40 |
private boolean compile = false; |
|
41 |
private String implStyle = GenerationConstants.USE_INTERNALS;
|
|
42 |
private String j2eeContainer = GenerationConstants.GERONIMO_CONTAINER;
|
|
43 |
|
|
44 | 0 |
public void execute() throws BuildException { |
45 | 0 |
try {
|
46 | 0 |
if (module == null) { |
47 | 0 |
throw new BuildException("the module name not specifed"); |
48 |
} |
|
49 | 0 |
root = project.getBaseDir(); |
50 | 0 |
File moduleFile = new File(root, module);
|
51 | 0 |
File outDirFile = new File(root, outDir);
|
52 | 0 |
AntClassLoader cl = new AntClassLoader(getClass().getClassLoader(),
|
53 |
project, |
|
54 |
classpath, |
|
55 |
true);
|
|
56 | 0 |
Thread.currentThread().setContextClassLoader(cl); |
57 | 0 |
AntDeployContext deployContext |
58 |
= new AntDeployContext(moduleFile.getAbsolutePath(),
|
|
59 |
outDirFile.getAbsolutePath(), cl, implStyle, j2eeContainer); |
|
60 | 0 |
Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null); |
61 | 0 |
ws4j2ee.generate(); |
62 |
} catch (Throwable e) {
|
|
63 | 0 |
try {
|
64 | 0 |
File errorDump = new File(root, "ews.log"); |
65 | 0 |
PrintWriter pw = new PrintWriter(new FileWriter(errorDump)); |
66 | 0 |
e.printStackTrace(pw); |
67 | 0 |
pw.close(); |
68 | 0 |
System.out.println(classpath); |
69 | 0 |
System.out.println("ERROR .. dump to " + errorDump.getAbsolutePath());
|
70 |
} catch (IOException e1) {
|
|
71 |
} |
|
72 | 0 |
throw new BuildException(e); |
73 |
} |
|
74 |
} |
|
75 |
|
|
76 | 0 |
public Location getLocation() {
|
77 | 0 |
return super.getLocation(); |
78 |
} |
|
79 |
|
|
80 | 0 |
public String getTaskName() {
|
81 | 0 |
return super.getTaskName(); |
82 |
} |
|
83 |
|
|
84 | 0 |
public void init() throws BuildException { |
85 | 0 |
super.init();
|
86 |
} |
|
87 |
|
|
88 | 0 |
public void setLocation(Location arg0) { |
89 | 0 |
super.setLocation(arg0);
|
90 |
} |
|
91 |
|
|
92 | 0 |
public void setTaskName(String arg0) { |
93 | 0 |
super.setTaskName(arg0);
|
94 |
} |
|
95 |
|
|
96 |
/**
|
|
97 |
* @return
|
|
98 |
*/
|
|
99 | 0 |
public Path getClasspath() {
|
100 | 0 |
return classpath;
|
101 |
} |
|
102 |
|
|
103 |
/**
|
|
104 |
* @return
|
|
105 |
*/
|
|
106 | 0 |
public String getModule() {
|
107 | 0 |
return module;
|
108 |
} |
|
109 |
|
|
110 |
/**
|
|
111 |
* @return
|
|
112 |
*/
|
|
113 | 0 |
public String getOutDir() {
|
114 | 0 |
return outDir;
|
115 |
} |
|
116 |
|
|
117 |
/**
|
|
118 |
* @param path
|
|
119 |
*/
|
|
120 | 0 |
public void setClasspath(Path path) { |
121 | 0 |
classpath = path; |
122 |
} |
|
123 |
|
|
124 |
/**
|
|
125 |
* @param string
|
|
126 |
*/
|
|
127 | 0 |
public void setModule(String string) { |
128 | 0 |
module = string; |
129 |
} |
|
130 |
|
|
131 |
/**
|
|
132 |
* @param string
|
|
133 |
*/
|
|
134 | 0 |
public void setOutDir(String string) { |
135 | 0 |
outDir = string; |
136 |
} |
|
137 |
|
|
138 | 0 |
public Path createClasspath() {
|
139 | 0 |
if (classpath == null) { |
140 | 0 |
classpath = new Path(project);
|
141 |
} |
|
142 | 0 |
return classpath.createPath();
|
143 |
} |
|
144 |
|
|
145 |
/**
|
|
146 |
* @return
|
|
147 |
*/
|
|
148 | 0 |
public boolean isCompile() { |
149 | 0 |
return compile;
|
150 |
} |
|
151 |
|
|
152 |
/**
|
|
153 |
* @param b
|
|
154 |
*/
|
|
155 | 0 |
public void setCompile(boolean b) { |
156 | 0 |
compile = b; |
157 |
} |
|
158 |
|
|
159 |
/**
|
|
160 |
* @return
|
|
161 |
*/
|
|
162 | 0 |
public String getImplStyle() {
|
163 | 0 |
return implStyle;
|
164 |
} |
|
165 |
|
|
166 |
/**
|
|
167 |
* @return
|
|
168 |
*/
|
|
169 | 0 |
public String getJ2eeContainer() {
|
170 | 0 |
return j2eeContainer;
|
171 |
} |
|
172 |
|
|
173 |
/**
|
|
174 |
* @param string
|
|
175 |
*/
|
|
176 | 0 |
public void setImplStyle(String string) { |
177 | 0 |
implStyle = string; |
178 |
} |
|
179 |
|
|
180 |
/**
|
|
181 |
* @param string
|
|
182 |
*/
|
|
183 | 0 |
public void setJ2eeContainer(String string) { |
184 | 0 |
j2eeContainer = string; |
185 |
} |
|
186 |
|
|
187 |
} |
|
188 |
|
|